#include<iostream>
#include<fstream>
#include<string>

#define FNAME "test.txt"

using namespace std;

int main(int argc, char* argv[]){
	ifstream fin(FNAME);
	string aline;

	cout << " Interview questions Ch. 13. " << endl;
	cout << "-----------------------------" << endl << endl;

	try{
		if(fin==NULL){
			throw("Empty file!");
		}

		//fin.seekg(-2, ios::end);
		while(!fin.eof()){
			getline(fin, aline);
			cout << aline << endl;
		}
	}
	catch(char errc[]){
		cerr << " Error: " << errc << endl;
		cin.get();
		return 0;
	}

	cin.get();

	return 1;
}